import React, { Component } from 'react'
import { PickerView } from 'antd-mobile-v2'
import FilterFooter from '../../../../components/FilterFooter'

export default class FilterPicker extends Component {
  state={
    value:this.props.defaultselect
  }
  handleValue = (value) => {
    this.setState({
      value: value
    })
  }
  render() {
    const {onCancel,filtersData,cols,onSave,Type}=this.props //调用取消filter组件的显示

    return (
      <>
        {/* pickerview选择器组件：,cols代码列，onchangge代表赛选出的值 */}
        <PickerView data={filtersData} value={this.state.value} cols={cols} onChange={val => {
            this.setState({
              value: val
            })
          }} />

        {/* 底部按钮 */}
        <FilterFooter onCancel={()=>onCancel(Type)} onOk={()=>onSave(Type,this.state.value)}/>
      </>
    )
  }
}
